package com.echo.register;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import java.util.ArrayList;

/**
 * @ClassName: DataListener
 * @Package: com.echo.register
 * @Description: EasyExcel 监听器
 * @Author 谢同学
 * @Create 2023/12/17 11:30
 * @Version 1.0
 */
public class DataListener extends AnalysisEventListener<User > {
    // 每读取一条数据需要做的操作
    ArrayList<User> userArrayList = new ArrayList<>();
    @Override
    public void invoke(User user, AnalysisContext analysisContext) {

        userArrayList.add(user);
    }
    // 读取完所有数据需要做的操作
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        userArrayList.forEach(System.out::println);
    }
}
